﻿/****** Object:  Table [dbo].[Departamente]    Script Date: 06/25/2009 07:37:46 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Departamente](
	[Cod] [varchar](20) NULL,
	[Nume] [varchar](50) NULL,
	[Activ] [bit] NULL,
	[IDDepartament] [int] IDENTITY(1,1) NOT NULL,
	[CodUnitate] [smallint] NOT NULL,
	[IDTipDepartament] [int] NOT NULL,
	[IDDepartParinte] [int] NOT NULL,
 CONSTRAINT [PK_Departamente] PRIMARY KEY CLUSTERED 
(
	[IDDepartament] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[Departamente]  WITH CHECK ADD  CONSTRAINT [FK_Departamente_TipDepartament] FOREIGN KEY([IDTipDepartament])
REFERENCES [dbo].[TipDepartament] ([IDTipDepartament])
GO

ALTER TABLE [dbo].[Departamente] CHECK CONSTRAINT [FK_Departamente_TipDepartament]
GO

ALTER TABLE [dbo].[Departamente]  WITH CHECK ADD  CONSTRAINT [FK_Departamente_Unitati] FOREIGN KEY([CodUnitate])
REFERENCES [dbo].[Unitati] ([CodUnitate])
GO

ALTER TABLE [dbo].[Departamente] CHECK CONSTRAINT [FK_Departamente_Unitati]
GO

ALTER TABLE [dbo].[Departamente] ADD  CONSTRAINT [DF_Departamente_CodUnitate]  DEFAULT ((0)) FOR [CodUnitate]
GO

ALTER TABLE [dbo].[Departamente] ADD  CONSTRAINT [DF_Departamente_IDTipDepartament]  DEFAULT ((0)) FOR [IDTipDepartament]
GO

ALTER TABLE [dbo].[Departamente] ADD  CONSTRAINT [DF_Departamente_IDDepartParinte]  DEFAULT ((0)) FOR [IDDepartParinte]
GO


